package com.tm.vo;

import java.util.List;

//分页工具
public class PageBean<T> {

    private Integer totalCount;     //总条数

    private Integer startCount;     //起始下标

    private Integer pageSize = 5;       //每页条数

    private Integer pageNumber;     //总页数

    private Integer nowPage = 1;        //当前页数

    private List<T> list;

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        //计算得到总页数和起始下标
        this.pageNumber = (totalCount % pageSize == 0) ? totalCount / pageSize : totalCount / pageSize +1;
        //起始下标
        this.startCount = ((nowPage - 1 ) * pageSize);
    }

    public Integer getStartCount() {
        return startCount;
    }

    public void setStartCount(Integer startCount) {
        this.startCount = startCount;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }

    public Integer getNowPage() {
        return nowPage;
    }

    public void setNowPage(Integer nowPage) {
        this.nowPage = nowPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
